<?php

namespace app\common\model;

/**
 * [McheckQuan  福券审核表]
 * @author [C。]
 * @return html
 */
class McheckQuan extends Base
{
    protected $name = 'mcheck_quan';
    /**
     * 根据搜索条件获取用户信息
     */
    public function getList($map,$from = 0, $size = 5)
    {
        $order = ['c.id' => 'desc'];
        $join1 = [
            ['app_member_quan mq','mq.member_quan_id = c.qid'],
        ];
        $join2 = [
            ['app_member m','m.id = mq.member_id'],
        ];
        $result =  $this->field('c.id,c.realname,c.tel,c.idcard,mq.fu_id,m.username,m.tel usertel,mq.addtime,mq.jing,c.sex,c.status,c.liketime')
            ->alias('c')
            ->join($join1)
            ->join($join2)
            ->where($map)
            ->limit($from, $size)
            ->order($order)
            ->select();

        return $result;
    }
    /**
     * 根据搜索条件获取用户信息
     */
    public function getCount($map)
    {
        $join1 = [
            ['app_member_quan mq','mq.member_quan_id = c.qid'],
        ];
        $join2 = [
            ['app_member m','m.id = mq.member_id'],
        ];
        $result =  $this
            ->alias('c')
            ->join($join1)
            ->join($join2)
            ->where($map)
            ->count();

        return $result;
    }
}